package com.study.model.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.List;


/**
 * The persistent class for the dept database table.
 * 
 */
@Entity
@NamedQuery(name="Dept.findAll", query="SELECT d FROM Dept d")
public class Dept implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="dep_id")
	private int depId;

	@Column(name="dep_name")
	private String depName;

	@Column(name="dep_superid")
	private int depSuperid;

	//bi-directional many-to-many association to Role
	@ManyToMany
	@JoinTable(
		name="deptrole"
		, joinColumns={
			@JoinColumn(name="dep_id")
			}
		, inverseJoinColumns={
			@JoinColumn(name="rol_id")
			}
		)
	private List<Role> roles1;

	//bi-directional many-to-many association to User
	@ManyToMany
	@JoinTable(
		name="usersdept"
		, joinColumns={
			@JoinColumn(name="dep_id")
			}
		, inverseJoinColumns={
			@JoinColumn(name="use_id")
			}
		)
	private List<User> users1;

	//bi-directional many-to-many association to Role
	@ManyToMany(mappedBy="depts2")
	private List<Role> roles2;

	//bi-directional many-to-many association to User
	@ManyToMany(mappedBy="depts2")
	private List<User> users2;
	
	
	// bi-directional many-to-one association to Moneybackplan
		@OneToMany(mappedBy = "repDept")
		private List<Repairlist> repairlists;
		
		

	public Dept() {
	}

	public int getDepId() {
		return this.depId;
	}

	public void setDepId(int depId) {
		this.depId = depId;
	}

	public String getDepName() {
		return this.depName;
	}

	public void setDepName(String depName) {
		this.depName = depName;
	}

	public int getDepSuperid() {
		return this.depSuperid;
	}

	public void setDepSuperid(int depSuperid) {
		this.depSuperid = depSuperid;
	}

	public List<Role> getRoles1() {
		return this.roles1;
	}

	public void setRoles1(List<Role> roles1) {
		this.roles1 = roles1;
	}

	public List<User> getUsers1() {
		return this.users1;
	}

	public void setUsers1(List<User> users1) {
		this.users1 = users1;
	}

	public List<Role> getRoles2() {
		return this.roles2;
	}

	public void setRoles2(List<Role> roles2) {
		this.roles2 = roles2;
	}

	public List<User> getUsers2() {
		return this.users2;
	}

	public void setUsers2(List<User> users2) {
		this.users2 = users2;
	}

	public List<Repairlist> getRepairlists() {
		return repairlists;
	}

	public void setRepairlists(List<Repairlist> repairlists) {
		this.repairlists = repairlists;
	}

	@Override
	public String toString() {
		return "Dept [depId=" + depId + ", depName=" + depName + ", depSuperid=" + depSuperid + "]";
	}


}